const Mock = require('mockjs')
const data = Mock.mock({
  'one': [
    '@integer(200000, 1000000)',
    '@integer(0, 100)',
    '@integer(0, 100)',
    '@integer(5000, 20000)'
  ],
  'two|5': [
    {
      'text|+1': [
        '项目相关',
        '高阶技术',
        '实践相关',
        '基础知识',
        '基础理论'
      ],
      'value|5': [
        '@integer(0, 100)'
      ],
      color: '@hex()',
      all: '@integer(5000, 20000)'
    }
  ],
  'three|5': [
    {
      'name|+1': [
        'UI',
        'C++',
        'python',
        'java',
        '前端'
      ],
      'value|100-1000': 100,
      all: '@integer(5000, 20000)'
    }
  ],
  'four|3': [
    {
      name: '@word(5)',
      'data|7': [
        '@integer(100, 300)'
      ],
      all: '@integer(5000, 20000)'
    }
  ],
  'five': [
    {
      name: 'web',
      'data_1|14': [
        '@integer(100, 300)'
      ],
      'data_2|14': [
        '@integer(100, 300)'
      ]
    },
    {
      name: 'java',
      'data_1|7': [
        '@integer(100, 300)'
      ],
      'data_2|7': [
        '@integer(100, 300)'
      ]
    }
  ],
  'sixs|50': [
    {
      keyword: '@cparagraph(1)',
      'num|300-1000': 100,
      'pie|1-100': 100
    }
  ],
  'seven|10': [
    {
      'name|+1': [
        '直达',
        '营销广告',
        '搜索引擎',
        '邮件营销',
        '联盟广告',
        '视频广告',
        '百度',
        '谷歌',
        '必应',
        '其他'
      ],
      'value|100-1500': 100
    }
  ]
})

module.exports = [
  {
    url: '/ech/list',
    type: 'get',
    response: config => {
      const { one, two, three, four, five, seven } = data
      return {
        code: 200,
        one,
        two,
        three,
        four,
        five,
        seven
      }
    }
  },
  {
    url: '/ech/six',
    type: 'get',
    response: config => {
      const { page, size } = config.query
      const { sixs } = data
      const six = sixs.slice((page - 1) * size, page * size)
      return {
        code: 200,
        six
      }
    }
  }
]
